package com.example.rent.mapper.zzh;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.example.rent.entity.Houseowner;
import com.example.rent.entity.Manager;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wanted
 * @since 2021-12-02
 */
@Repository
public interface ManagerMapper extends BaseMapper<Manager> {
        @Select("select * from manager where password = #{password} and count = #{username}")
             Manager getlist(String username,String password);

        @Update("update houseowner set hphone=#{newphone}, housename=#{housename}," +
                " address=#{address}, freetime=#{freetime} where hphone=#{oldphone}")
        int update(Long oldphone,Long newphone,String housename,String address,String freetime);

        @Delete("delete from houseowner where hphone=#{hone}")
        int delete(Long hone);

        @Insert("insert into houseowner (hphone,housename,address,freetime,password) " +
                "values(#{phone},#{name},#{address},#{freetime},#{password})")
        int add(Long phone,String name,String address,String freetime,String password);



}
